﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace Auto_Buy.Component
{
    /// <summary>
    /// 产品列表
    /// </summary>
    public class ProductList
    {
        public static async Task<List<ProductSubInfo>> GetListByType(int type)
        {

            var body = new RequestBody();
            body.Method = "ProductList";
            var d = JsonConvert.SerializeObject(new { TypeId = type });
            body.Data = d;
            var respone = await HttpUnit.Post( body);
            if (respone.IsSuccessStatusCode)
            {
                var res = await respone.Content.ReadAsStringAsync();
                //Console.WriteLine(res);
                return ResponseBody.GetGridData<ProductSubInfo>(res);
            }
            Console.WriteLine("http error");
            return null;
        }
    }


}
